<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="../css/swiper-4.3.5.min.css">
    <link rel="stylesheet" href="../css/element.css">
    <link rel="stylesheet" href="../css/main.css">
    <link rel="stylesheet" href="../css/person_center/person_center.css">
    <title>会员中心-我的收藏</title>
</head>

<body>
    <div id="app" v-cloak>
        <headers></headers>
        <!-- search -->
        <div class="search wrap">
            <logo></logo>
            <div class="header_tit fl"></div>
            <searchs></searchs>

            <car_box></car_box>

        </div>
        <div class="wrap person_center clear_both">
            <!-- nav -->
            <div class="nav_box fl">
                <div id="subapp" v-cloak>
                    <div class="person_nav fl">
                        <ul>
                            <li @click='person_order'>首页</li>
                            <li @click='person_center'>我的订单</li>
                            <li @click='person_address'>收货地址</li>
                            <li @click='person_exchange_page'>积分换货</li>
                            <li @click='person_intergal'>积分订单</li>
                            <li class="active">我的收藏</li>
                            <li @click='person_foot'>浏览足迹</li>
                            <li @click='person_ticket'>优惠券</li>
                            <li @click='person_info'>个人设置</li>
                            <li @click='person_message'>消息中心</li>
                        </ul>
                    </div>
                </div>
            </div>

            <div class="right_box fl">
                <div class="person_collection">
                    <div class="all_exchange">
                        <ul class="fl">
                            <li class="collection_nav" @click="all_order" :class="{active:now_index==0}">全部订单</li>
                            <!-- <li class="collection_nav" @click="jiangjia" :class="{active:now_index==1}">降价（2）</li>
                            <li class="collection_nav" @click="youhui" :class="{active:now_index==2}">优惠（0）</li> -->
                        </ul>
                        <!-- <div class="time_order fr">近三个月订单 <img src="../images/icon_down.png" alt=""></div> -->
                    </div>

                    <div class="collection_list clear_both">
                        <div class="collection_item fl" v-for='(item,index) in spuList' @mouseover='del_over(index)' @mouseout='del_leave(index)'>
                            <div class="collection_img cursor" @click='detail(item.id)'>
                                <img :src="item.coverImg" alt="">
                            </div>
                            <p class="collection_tit">{{item.spuName}}</p>
                            <div class="collection_money">
                                <span>￥</span>{{item.showPrice}}
                            </div>
                            <div class="del_collection cursor" v-show="index===del_index" @click='collectMdse(item.id)'>
                                <img src="../images/icon_del_0.png" alt="">
                            </div>
                        </div>
                    </div>
                </div>


            </div>

        </div>




        <div class="footer_wrap">
           <div class="wrap clear_both">             <productfooter></productfooter>         </div>
        </div>
    </div>
     
    <script src="../js/axios.js"></script>         <script src="../js/qs.js"></script>
    <script src="../js/swiper-4.3.5.min.js"></script>
    <script src="../js/browser.min.js"></script>
    <script src="../js/vue.js"></script>
    <script src="../js/element.js"></script>
    <script src="../js/main.js"></script>
    <script type="text/babel">
        var app = new Vue({
            el: '#app',
            data() {
                return {
                    address:12,
                    car_active:false,
                    groups:3,
                    now_index:0,
                    // 我的收藏列表
                    spuList:'',
                    del_index:''
                };
            },
            created() {
                
            },
            mounted() {
                this.getCollectList()
            },
            methods: {
                detail(id){
                    window.location.href='../product/product_detail.html?id='+id
                },
                // 收藏详情
                // collection(id){
                //     window.location.href='../product/product_detail.html?id='+id
                // },
                // 取消收藏
                collectMdse(id){
                    axios({
                        method:"POST",
                        url:base_url + "/web/mdse/collectMdse",
                        data:Qs.stringify({
                            spuId:id,
                            collectStatus:1
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                        if (res.data.code==1) {
                            app.$message.success("删除收藏成功");
                            app.getCollectList()
                        }
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },
                // 我的收藏
                
                getCollectList(){
                    axios({
                        method:"POST",
                        url:base_url + "/web/mdse/getCollectList",
                        data:Qs.stringify({
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                        console.log(res.data.data.spuList)
                        app.spuList = res.data.data.spuList
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },
                del_over(index){
                    app.del_index = index
                },
                del_leave(index){
                    app.del_index = ''
                },
                // 显示购物车               
                go_shop_car(){                     
                    window.location.href='../product/shop_car.html'  
                },
                car_box(){
                    this.car_active = !this.car_active
                },
                person_order(){
                    window.location.href='person_order.html'
                },
                person_address(){
                    window.location.href='person_address.html'
                },
                person_exchange_page(){
                    window.location.href='person_exchange_page.html'
                },
                person_center(){
                    window.location.href='person_center.html?index='+0
                },
                person_intergal(){
                    window.location.href='person_integral_order.html'
                },
                person_foot(){
                    window.location.href='person_footprint.html'
                },
                person_info(){
                    window.location.href='person_info.html'
                },
                person_message(){
                    window.location.href='person_message.html'
                },
                person_ticket(){
                    window.location.href='person_ticket.html'
                },
                all_order(){
                    this.now_index = 0
                },
                jiangjia(){
                    this.now_index = 1
                },
                youhui(){
                    this.now_index = 2
                }
            }
        })
        
    </script>
</body>

</html>